<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/css/table.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/dwz/themes/default/style.css" rel="stylesheet" type="text/css" media="screen" />
<link href="${pageContext.request.contextPath}/dwz/themes/css/core.css" rel="stylesheet" type="text/css" media="screen" />
<script src="${pageContext.request.contextPath}/laydate/laydate.js" ></script>
<script src="${pageContext.request.contextPath}/jquery/jquery-2.1.4.min.js"></script>
<table border="0" cellpadding="0" cellspacing="0" class="table_border">
	<tr>
		<td>
			<table width="100%" border="0" cellpadding="0" cellspacing="0"
				class="table_right">
				<tr>
					<td><font style="font-size: 12px;"><strong>新增用户</strong></font>
					</td>
					<td width="25" height="26" align="left"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table width="100%" border="0" cellspacing="0" class="table_right">
				<tr>
					<td align="center">
						<table width="100%" border="0" cellspacing="0"
							class="table_padding">
							<tr>
								<td align="center">
									<table border="0" cellpadding="0" cellspacing="0"
										class="box_table" id="box_table2">
										<thead>
											<tr>
												<td class="box_table_even">登录帐号：</td>
												<td class="box_table_odd">
													<span class="in">
														<input type="text" id="accountNo"/>
														<span class="star">*</span>
													</span>
												</td>
											</tr>
											<tr>
												<td class="box_table_even">用户姓名：</td>
												<td class="box_table_odd">
													<span class="in">
														<input type="text" id="name"/>
														<span class="star">*</span>
													</span>
												</td>
											</tr>
											<tr>
												<td class="box_table_even">电子邮件：</td>
												<td class="box_table_odd">
													<span class="in">
														<input type="text" id="email"/>
														<span class="star">*</span>
													</span>
												</td>
											</tr>
											<tr>
												<td class="box_table_even">登录密码：</td>
												<td class="box_table_odd">
													<span class="in">
														<input type="password" id="password"/>
														<span class="star">*</span>
													</span>
												</td>
											</tr>
											<tr>
												<td class="box_table_even">密码确认：</td>
												<td class="box_table_odd">
													<span class="in">
														<input type="password" id="surePassword"/>
														<span class="star">*</span>
													</span>
												</td>
											</tr>
											<tr>
												<td class="box_table_even">是否启用：</td>
												<td class="box_table_odd">
													<input type="radio" name="status" value="1" checked/> 启用
													<input type="radio" name="status" value="0"/> 锁定
													<span class="star">*</span>
												</td>
											</tr>
											<tr>
												<td class="box_table_even">失效时间：</td>
												<td class="box_table_odd">
													<input type="text" id="expireTime"/>
													<span class="star">*</span>
												</td>
											</tr>
											<tr>
												<td class="box_table_even">允许访问的IP：</td>
												<td class="box_table_odd">
													<span class="in">
														<input type="text" size="120" id="allowIps"/>
													</span>
												</td>
											</tr>
										</thead>
										<tbody>
										</tbody>
									</table>
								</td>
							</tr>
						</table>

						<table border="0" cellpadding="0" cellspacing="0"
							class="operation">
							<thead>
								<tr>
									<td height="24">&nbsp;</td>
								</tr>
							</thead>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table width="100%" border="0" cellpadding="0" cellspacing="0"
				class="table_padding">
				<tr>
					<td height="21" align="right">
						<table align="left">
							<tr>
								<td width="50px"><a class="button" href="javascript:void(0)" onclick="save()"><span>保存</span></a></td>
								<td width="50px"><a class="button"
									href="javascript:void(window.history.back());"><span>返回</span></a></td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<script>
	//执行一个laydate实例
	laydate.render({
		elem: '#expireTime', //指定元素
		type:'datetime'
	});
</script>
<script>
	function save() {
		var json = {
			"accountNo":$("#accountNo").val(),
			"name":$("#name").val(),
			"email":$("#email").val(),
			"password":$("#password").val(),
			"lockStatus":$(":radio[name='status']:checked").val(),
			"expireTime":$("#expireTime").val(),
			"allowIps":$("#allowIps").val()
		}
		$.post("user?method=addUser",json,function (result) {
			if (result.code=="200"){
				alert("添加成功")
			}else {
				alert("添加失败")
			}
		},"json");
	}

</script>

